package co.yixiang.modules.shop.service.impl;

import co.yixiang.modules.shop.entity.YxStoreProductCheckmake;
import co.yixiang.modules.shop.mapper.YxStoreProductCheckmakeMapper;
import co.yixiang.modules.shop.service.YxStoreProductCheckmakeService;
import co.yixiang.modules.shop.web.param.YxStoreProductCheckmakeQueryParam;
import co.yixiang.modules.shop.web.vo.YxStoreProductCheckmakeQueryVo;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
import java.util.List;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author frq
 * @since 2020-07-16
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class YxStoreProductCheckmakeServiceImpl extends BaseServiceImpl<YxStoreProductCheckmakeMapper, YxStoreProductCheckmake> implements YxStoreProductCheckmakeService {

    @Autowired
    private YxStoreProductCheckmakeMapper yxStoreProductCheckmakeMapper;

    @Override
    public YxStoreProductCheckmakeQueryVo getYxStoreProductCheckmakeById(Serializable id) throws Exception{
        return yxStoreProductCheckmakeMapper.getYxStoreProductCheckmakeById(id);
    }

    @Override
    public Paging<YxStoreProductCheckmakeQueryVo> getYxStoreProductCheckmakePageList(YxStoreProductCheckmakeQueryParam yxStoreProductCheckmakeQueryParam) throws Exception{
        Page page = setPageParam(yxStoreProductCheckmakeQueryParam,OrderItem.desc("create_time"));
        IPage<YxStoreProductCheckmakeQueryVo> iPage = yxStoreProductCheckmakeMapper.getYxStoreProductCheckmakePageList(page,yxStoreProductCheckmakeQueryParam);
        return new Paging(iPage);
    }

    /**
     * 查询盘点信息
     * @param param
     * @return
     */
    @Override
    public List<YxStoreProductCheckmakeQueryVo> findInventory(YxStoreProductCheckmakeQueryParam param) {
        return yxStoreProductCheckmakeMapper.findInventory(param);
    }

}
